package graphic.primitives.town;

import graphic.primitives.general.GraphicObject;
import graphic.primitives.general.IGraphicObject;
import java.awt.Color;

/**
 *
 * @author Tomas Zima
 */
public class Railing extends GraphicObject implements IGraphicObject
{
	public Railing(int x, int y, int w, int h)
	{
		super(x, y);
		this.width	= w;
		this.height	= h;
	}

	@Override
	public void redraw()
	{
		mainWindow.setColor(new Color(0.7f, 0.7f, 0.7f));
		
		for (int i = 0; i < 3; i++)
		{
			mainWindow.line(x, y + i, x + width, y + i);
			mainWindow.line(x, y + height + i, x + width, y + height + i);
		}
		
		for (int i = 0; i < width; i += 20)
		{
			mainWindow.line(x + i, y, x + i, y + height);
		}
		
		mainWindow.setColor(Color.BLACK);
	}
	
	private int width;
	private int height;
}
